<extend name="Base/common" />

<block name="style">
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/Api/css/order.css">
	<style>
		body,li,p,ul { 
		    margin: 0;
		    padding: 0;
		    font: 12px/1 Tahoma, Helvetica, Arial, "\5b8b\4f53", sans-serif;
		}
		ul, li, ol { list-style: none; }
		/* 重置文本格式元素 */
		a { text-decoration: none; cursor: pointer; color:#333333; font-size:14px;}
		a:hover { text-decoration: none; }
		.clearfix::after{ display:block; content:''; height:0; overflow:hidden; clear:both;} 
		/*星星样式*/
		.content{ width:600px; margin:0 auto; padding-top:20px;}
		.title{ font-size:14px; background:#dfdfdf; padding:10px; margin-bottom:10px;}
		.block{ width:100%; margin:0 0 20px 0; padding-top:10px; padding-left:50px; line-height:21px;}
		.block .star_score{ float:left;}
		.star_list{height:21px;margin:50px; line-height:21px;}
		.block p,.block .attitude{ padding-left:20px; line-height:21px; display:inline-block;}
		.block p span{ color:#C00; font-size:16px; font-family:Georgia, "Times New Roman", Times, serif;}
		.star_score { background:url(__PUBLIC__/Api/images/stark2.png); width:160px; height:21px;  position:relative; }
		.star_score a{ height:21px; display:block; text-indent:-999em; position:absolute;left:0;}
		.star_score a:hover{ background:url(__PUBLIC__/Api/images/stars2.png);left:0;}
		.star_score a.clibg{ background:url(__PUBLIC__/Api/images/stars2.png);left:0;}
		#starttwo .star_score { background:url(__PUBLIC__/Api/images/starky.png);}
		#starttwo .star_score a:hover{ background:url(__PUBLIC__/Api/images/starsy.png);left:0;}
		#starttwo .star_score a.clibg{ background:url(__PUBLIC__/Api/images/starsy.png);left:0;}
		/*星星样式*/
		.show_number{ padding-left:50px; padding-top:20px;}
		.show_number li{ width:240px; border:1px solid #ccc; padding:10px; margin-right:5px; margin-bottom:20px;}
		.atar_Show{background:url(__PUBLIC__/Api/images/stark2.png); width:160px; height:21px;  position:relative; float:left; }
		.atar_Show p{ background:url(__PUBLIC__/Api/images/stars2.png);left:0; height:21px; width:134px;}
		.show_number li span{ display:inline-block; line-height:21px;}
	</style>
	
	
</block>

<block name="Content">
<div class="page-group">
    <div class="page page-current my-order">
        <div class="order-foot bar bar-standard bar-footer">
            <div class="content-block order-foot-block">
                <div class="row">
                    <div class="col-100">
                    	<a href="#" onclick="submit()" class="button button-big button-fill button-pay">立即点评</a>
                    </div>
                </div>
            </div>
        </div>
        <div class="content">
            <div class="order-detail-top">
                <div class="list-block media-list">
                    <ul>
                        <li class="order-p">
                            <div class="item-content">
                                <div class="item-media">
                                    <img src="{$workerModel['fullpath']|default='__PUBLIC__/Api/images/person1.png'}" alt="">
                                </div>
                                <div class="item-inner">
                                    <div class="item-title-row">
                                        <div class="item-title item-p">{$workerModel['name']}</div>
                                    </div>
                                    <div class="item-subtitle">工号：{$workerModel['eid']}</div>
                                    <div class="item-subtitle">工种：{:get_dictionary_enum_name('profession_options', $workerModel['profession'])}</div>
                                </div>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="order-details">
                <div id="startone" class="block clearfix">
					<div style="width: 160px;" class="star_score"></div>
			        <p style="float:left;">您的评分：<span class="fenshu"></span> 分</p>
			    </div>
                <div class="comment-details">
                    <textarea name="content" id="content" placeholder="您的点评就是小哥前进的动力，写点什么吧…"></textarea>
                    <input type="hidden" name="order_id" id="order_id" value="{$order_id}"/>
                    <input type="hidden" name="worker_id" id="worker_id" value="{$workerModel['worker_id']}"/>
                </div>
            </div>
        </div>
    </div>
</div>
</block>

<block name="script">
<script src="__PUBLIC__/Api/js/startScore.js" type="text/javascript"></script>
<script type="text/javascript">
scoreFun($("#startone"));

function submit(){
	var score = $(".fenshu").html();
	var content = $("#content").val();
	var target = Think.U('Worker/comment');
	var workerID = $("#worker_id").val();
	var orderID = $("#order_id").val();
	
	if(!score || isNaN(score)){
		$.toast('请为小哥打分');
		return false;
	}
	
	if(isNaN(workerID) || isNaN(orderID)){
		$.toast('参数错误，请刷新后再试');
		return false;
	}
	
	$.post(target, {'score':score, 'content':content, 'worker_id':workerID, 'order_id':orderID}, function(data){
		
		if(data.status == 1){
			$.alert('点评成功', function(){
				window.location.href = Think.U('Orders/index', 'type=4');
			});
		}else if(data.status == '-201'){
			$.confirm('身份认证已失效，请重新登录', function () {
		        window.location.href = Think.U('Public/login');
		    });
		}else if(data.status == '-1'){
			$.alert('已评价该订单，不可重复评价', function(){
				window.location.href = Think.U('Orders/index', 'type=4');
			});
		}else{
			$.toast('点评失败，请刷新后再试');
		}
	});
	
}

</script>
</block>

